package cn.idietrade.idietradeservicemodule8001.service.impl;

import cn.idietrade.common.pojo.SecondService;
import cn.idietrade.idietradeservicemodule8001.mapper.SecondServiceMapper;
import cn.idietrade.idietradeservicemodule8001.service.SecondServiceService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zjy
 * @version 1.0
 * @createTime 2022-11-29 17:25
 * @description
 */
@Service
public class SecondServiceServiceImpl implements SecondServiceService {
    @Resource
    private SecondServiceMapper secondServiceMapper;

    @Override
    public PageInfo<SecondService> queryChattingRecordsAll(Integer pageNum, Integer pageSize,Integer userId) {
        if(pageNum==null||pageNum<=1){
            pageNum=1;
        }
        if(pageSize==null){
            pageSize=5;
        }
        PageHelper.startPage(pageNum,pageSize);
        PageInfo<SecondService> pageInfo=new PageInfo<>(secondServiceMapper.queryChattingRecordsAll(userId));
        return pageInfo;
    }

    @Override
    public int saveChattingRecords(SecondService secondService) {
        return secondServiceMapper.saveChattingRecords(secondService);
    }


    @Override
    public int updateServiceState(Integer serviceId) {
        return secondServiceMapper.updateServiceState(serviceId);
    }
}
